package com.example;

import com.example.config.AuthorSettings;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 组合注解 @SpringBootApplication:@EnableAutoConfiguration,
 */
@RestController
@SpringBootApplication
public class SpringbootbookApplication {

    @Value("${book.name}")
    private String bookName;
    @Value("${book.author}")
    private String bookAuthor;

    @Autowired
    private AuthorSettings authorSettings;



    @RequestMapping("/")
    public String index() {
        return "book name is: " + bookName + " author: " + bookAuthor;
    }

    @RequestMapping("/ceshi")
    public String index1() {

        return "作者名字: " + authorSettings.getName() + ",年龄: " + authorSettings.getAge();
    }

    public static void main(String[] args) {
        SpringApplication.run(SpringbootbookApplication.class, args);
    }
}
